#ifndef RSTREAM_H
#define RSTREAM_H

#include <System/String.h>
#include <System/Array.h>
#include <System/Object.h>
#include <System/IO/SeekOrigin.h>

namespace Riccsson
{
	namespace System
	{
		namespace Collections
		{
			namespace Generic
			{
				template<typename> class Task;
			}
		}

		namespace IO
		{

			// Not implemented classes.
			class IAsyncResult;
			class CancellationToken;
			class Task;
			class WaitHandle;
			class AsyncCallback;

			/// <summary>
			///     Provides a generic view of a sequence of bytes.
			/// </summary>
			class Stream
				: public Riccsson::System::Object
				, public Riccsson::System::IDisposable
			{

				// Summary:
				//     A Stream with no backing store.
				//public: static readonly Stream Null;
				
				PROP3(Stream, bool, CanRead)
				PROP3(Stream, bool, CanSeek)
				PROP3(Stream, bool, CanTimeout)
				PROP3(Stream, bool, CanWrite)
				PROP3GET(Stream, long, Length)
				PROP3(Stream, long, Position)
				PROP3(Stream, int, ReadTimeout)
				PROP3(Stream, int, WriteTimeout)

				COPY_CONSTRUCTOR(Stream)
				{
					PROP3_INIT_COPY(Stream, bool, CanRead);
					PROP3_INIT_COPY(Stream, bool, CanSeek);
					PROP3_INIT_COPY(Stream, bool, CanTimeout);
					PROP3_INIT_COPY(Stream, bool, CanWrite);
					PROP3GET_INIT_COPY(Stream, long, Length);
					PROP3_INIT_COPY(Stream, long, Position);
					PROP3_INIT_COPY(Stream, int, ReadTimeout);
					PROP3_INIT_COPY(Stream, int, WriteTimeout);
				}

				// Summary:
				//     Initializes a new instance of the System.IO.Stream class.
				protected: Stream()
					: PROP3_INIT(Stream, CanRead)
					, PROP3_INIT(Stream, CanSeek)
					, PROP3_INIT(Stream, CanTimeout)
					, PROP3_INIT(Stream, CanWrite)
					, PROP3GET_INIT(Stream, Length)
					, PROP3_INIT(Stream, Position)
					, PROP3_INIT(Stream, ReadTimeout)
					, PROP3_INIT(Stream, WriteTimeout)
				{

				}

				public: virtual ~Stream()
				{

				}

				// Summary:
				//     When overridden in a derived class, gets a value indicating whether the current
				//     stream supports reading.
				//
				// Returns:
				//     true if the stream supports reading; otherwise, false.
				//public: abstract bool CanRead { get; }
				public: virtual PROP3_GET(bool, CanRead) = 0;
				private: PROP3_SET(bool, CanRead){throw;}

				//
				// Summary:
				//     When overridden in a derived class, gets a value indicating whether the current
				//     stream supports seeking.
				//
				// Returns:
				//     true if the stream supports seeking; otherwise, false.
				//public: abstract bool CanSeek { get; }
				public: virtual PROP3_GET(bool, CanSeek) = 0;
				private: PROP3_SET(bool, CanSeek){throw;}

				//
				// Summary:
				//     Gets a value that determines whether the current stream can time out.
				//
				// Returns:
				//     A value that determines whether the current stream can time out.
				//[ComVisible(false)]
				//public: virtual bool CanTimeout { get; }
				public: virtual PROP3_GET(bool, CanTimeout)
				{
					throw;
				}
				private: PROP3_SET(bool, CanTimeout){throw;}

				//
				// Summary:
				//     When overridden in a derived class, gets a value indicating whether the current
				//     stream supports writing.
				//
				// Returns:
				//     true if the stream supports writing; otherwise, false.
				//public: abstract bool CanWrite { get; }
				public: virtual PROP3_GET(bool, CanWrite) = 0;
				private: PROP3_SET(bool, CanWrite){throw;}

				//
				// Summary:
				//     When overridden in a derived class, gets the length in bytes of the stream.
				//
				// Returns:
				//     A long value representing the length of the stream in bytes.
				//
				// Exceptions:
				//   System.NotSupportedException:
				//     A class derived from Stream does not support seeking.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				//public: abstract long Length { get; }
				public: virtual PROP3_GET(long, Length) = 0;

				//
				// Summary:
				//     When overridden in a derived class, gets or sets the position within the
				//     current stream.
				//
				// Returns:
				//     The current position within the stream.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     An I/O error occurs.
				//
				//   System.NotSupportedException:
				//     The stream does not support seeking.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				//public: abstract long Position { get; set; }
				public: virtual PROP3_GET(long, Position) = 0;
				public: virtual PROP3_SET(long, Position) = 0;
				//
				// Summary:
				//     Gets or sets a value, in miliseconds, that determines how long the stream
				//     will attempt to read before timing out.
				//
				// Returns:
				//     A value, in miliseconds, that determines how long the stream will attempt
				//     to read before timing out.
				//
				// Exceptions:
				//   System.InvalidOperationException:
				//     The System.IO.Stream.ReadTimeout method always throws an System.InvalidOperationException.
				//[ComVisible(false)]
				//public: virtual int ReadTimeout { get; set; }
				public: virtual PROP3_GET(int, ReadTimeout)
				{
					throw;
				}
				public: virtual PROP3_SET(int, ReadTimeout)
				{
					throw;
				}

				//
				// Summary:
				//     Gets or sets a value, in miliseconds, that determines how long the stream
				//     will attempt to write before timing out.
				//
				// Returns:
				//     A value, in miliseconds, that determines how long the stream will attempt
				//     to write before timing out.
				//
				// Exceptions:
				//   System.InvalidOperationException:
				//     The System.IO.Stream.WriteTimeout method always throws an System.InvalidOperationException.
				//[ComVisible(false)]
				//public: virtual int WriteTimeout { get; set; }
				public: virtual PROP3_GET(int, WriteTimeout)
				{
					throw;
				}
				public: virtual PROP3_SET(int, WriteTimeout)
				{
					throw;
				}

				// Summary:
				//     Begins an asynchronous read operation. (Consider using System.IO.Stream.ReadAsync(System.Byte[],System.Int32,System.Int32)
				//     instead; see the Remarks section.)
				//
				// Parameters:
				//   buffer:
				//     The buffer to read the data into.
				//
				//   offset:
				//     The byte offset in buffer at which to begin writing data read from the stream.
				//
				//   count:
				//     The maximum number of bytes to read.
				//
				//   callback:
				//     An optional asynchronous callback, to be called when the read is complete.
				//
				//   state:
				//     A user-provided object that distinguishes this particular asynchronous read
				//     request from other requests.
				//
				// Returns:
				//     An System.IAsyncResult that represents the asynchronous read, which could
				//     still be pending.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     Attempted an asynchronous read past the end of the stream, or a disk error
				//     occurs.
				//
				//   System.ArgumentException:
				//     One or more of the arguments is invalid.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				//
				//   System.NotSupportedException:
				//     The current Stream implementation does not support the read operation.
				public: virtual GC_PTR<IAsyncResult> BeginRead(Array<byte>* buffer, int offset, int count, AsyncCallback* callback, object* state)
				{
					throw;
				}

				//
				// Summary:
				//     Begins an asynchronous write operation. (Consider using System.IO.Stream.WriteAsync(System.Byte[],System.Int32,System.Int32)
				//     instead; see the Remarks section.)
				//
				// Parameters:
				//   buffer:
				//     The buffer to write data from.
				//
				//   offset:
				//     The byte offset in buffer from which to begin writing.
				//
				//   count:
				//     The maximum number of bytes to write.
				//
				//   callback:
				//     An optional asynchronous callback, to be called when the write is complete.
				//
				//   state:
				//     A user-provided object that distinguishes this particular asynchronous write
				//     request from other requests.
				//
				// Returns:
				//     An IAsyncResult that represents the asynchronous write, which could still
				//     be pending.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     Attempted an asynchronous write past the end of the stream, or a disk error
				//     occurs.
				//
				//   System.ArgumentException:
				//     One or more of the arguments is invalid.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				//
				//   System.NotSupportedException:
				//     The current Stream implementation does not support the write operation.
				public: virtual GC_PTR<IAsyncResult> BeginWrite(Array<byte>* buffer, int offset, int count, AsyncCallback* callback, object* state)
				{
					throw;
				}

				//
				// Summary:
				//     Closes the current stream and releases any resources (such as sockets and
				//     file handles) associated with the current stream. Instead of calling this
				//     method, ensure that the stream is properly disposed.
				public: virtual void Close()
				{
					Dispose(true);
				}

				//
				// Summary:
				//     Reads the bytes from the current stream and writes them to another stream.
				//
				// Parameters:
				//   destination:
				//     The stream to which the contents of the current stream will be copied.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     destination is null.
				//
				//   System.NotSupportedException:
				//     The current stream does not support reading.-or-destination does not support
				//     writing.
				//
				//   System.ObjectDisposedException:
				//     Either the current stream or destination were closed before the System.IO.Stream.CopyTo(System.IO.Stream)
				//     method was called.
				//
				//   System.IO.IOException:
				//     An I/O error occurred.
				public: void CopyTo(Stream* destination)
				{
					throw;
				}

				//
				// Summary:
				//     Reads the bytes from the current stream and writes them to another stream,
				//     using a specified buffer size.
				//
				// Parameters:
				//   destination:
				//     The stream to which the contents of the current stream will be copied.
				//
				//   bufferSize:
				//     The size of the buffer. This value must be greater than zero. The default
				//     size is 4096.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     destination is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     bufferSize is negative or zero.
				//
				//   System.NotSupportedException:
				//     The current stream does not support reading.-or-destination does not support
				//     writing.
				//
				//   System.ObjectDisposedException:
				//     Either the current stream or destination were closed before the System.IO.Stream.CopyTo(System.IO.Stream)
				//     method was called.
				//
				//   System.IO.IOException:
				//     An I/O error occurred.
				public: void CopyTo(Stream* destination, int bufferSize)
				{
					throw;
				}

				//
				// Summary:
				//     Asynchronously reads the bytes from the current stream and writes them to
				//     another stream.
				//
				// Parameters:
				//   destination:
				//     The stream to which the contents of the current stream will be copied.
				//
				// Returns:
				//     A task that represents the asynchronous copy operation.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     destination is null.
				//
				//   System.ObjectDisposedException:
				//     Either the current stream or the destination stream is disposed.
				//
				//   System.NotSupportedException:
				//     The current stream does not support reading, or the destination stream does
				//     not support writing.
				//[ComVisible(false)]
				public: GC_PTR<Task> CopyToAsync(Stream* destination)
				{
					throw;
				}

				//
				// Summary:
				//     Asynchronously reads the bytes from the current stream and writes them to
				//     another stream, using a specified buffer size.
				//
				// Parameters:
				//   destination:
				//     The stream to which the contents of the current stream will be copied.
				//
				//   bufferSize:
				//     The size, in bytes, of the buffer. This value must be greater than zero.
				//     The default size is 4096.
				//
				// Returns:
				//     A task that represents the asynchronous copy operation.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     destination is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     buffersize is negative or zero.
				//
				//   System.ObjectDisposedException:
				//     Either the current stream or the destination stream is disposed.
				//
				//   System.NotSupportedException:
				//     The current stream does not support reading, or the destination stream does
				//     not support writing.
				//[ComVisible(false)]
				public: GC_PTR<Task> CopyToAsync(Stream* destination, int bufferSize)
				{
					throw;
				}

				//
				// Summary:
				//     Asynchronously reads the bytes from the current stream and writes them to
				//     another stream, using a specified buffer size and cancellation token.
				//
				// Parameters:
				//   destination:
				//     The stream to which the contents of the current stream will be copied.
				//
				//   bufferSize:
				//     The size, in bytes, of the buffer. This value must be greater than zero.
				//     The default size is 4096.
				//
				//   cancellationToken:
				//     The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
				//
				// Returns:
				//     A task that represents the asynchronous copy operation.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     destination is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     buffersize is negative or zero.
				//
				//   System.ObjectDisposedException:
				//     Either the current stream or the destination stream is disposed.
				//
				//   System.NotSupportedException:
				//     The current stream does not support reading, or the destination stream does
				//     not support writing.
				//[ComVisible(false)]
				public: virtual GC_PTR<Task> CopyToAsync(Stream* destination, int bufferSize, CancellationToken* cancellationToken)
				{
					throw;
				}

				//
				// Summary:
				//     Allocates a System.Threading.WaitHandle object.
				//
				// Returns:
				//     A reference to the allocated WaitHandle.
				//[Obsolete(@"CreateWaitHandle will be removed eventually.  Please use ""new ManualResetEvent(false)"" instead.")]
				protected: virtual GC_PTR<WaitHandle> CreateWaitHandle()
				{
					throw;
				}

				//
				// Summary:
				//     Releases all resources used by the System.IO.Stream.
				public: void Dispose()
				{
					Dispose(true);
				}

				//
				// Summary:
				//     Releases the unmanaged resources used by the System.IO.Stream and optionally
				//     releases the managed resources.
				//
				// Parameters:
				//   disposing:
				//     true to release both managed and unmanaged resources; false to release only
				//     unmanaged resources.
				protected: virtual void Dispose(bool disposing)
				{
					throw;
				}

				//
				// Summary:
				//     Waits for the pending asynchronous read to complete. (Consider using System.IO.Stream.ReadAsync(System.Byte[],System.Int32,System.Int32)
				//     instead; see the Remarks section.)
				//
				// Parameters:
				//   asyncResult:
				//     The reference to the pending asynchronous request to finish.
				//
				// Returns:
				//     The number of bytes read from the stream, between zero (0) and the number
				//     of bytes you requested. Streams return zero (0) only at the end of the stream,
				//     otherwise, they should block until at least one byte is available.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     asyncResult is null.
				//
				//   System.ArgumentException:
				//     A handle to the pending read operation is not available.-or-The pending operation
				//     does not support reading.
				//
				//   System.InvalidOperationException:
				//     asyncResult did not originate from a System.IO.Stream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)
				//     method on the current stream.
				//
				//   System.IO.IOException:
				//     The stream is closed or an internal error has occurred.
				public: virtual int EndRead(IAsyncResult* asyncResult)
				{
					throw;
				}

				//
				// Summary:
				//     Ends an asynchronous write operation. (Consider using System.IO.Stream.WriteAsync(System.Byte[],System.Int32,System.Int32)
				//     instead; see the Remarks section.)
				//
				// Parameters:
				//   asyncResult:
				//     A reference to the outstanding asynchronous I/O request.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     asyncResult is null.
				//
				//   System.ArgumentException:
				//     A handle to the pending write operation is not available.-or-The pending
				//     operation does not support writing.
				//
				//   System.InvalidOperationException:
				//     asyncResult did not originate from a System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)
				//     method on the current stream.
				//
				//   System.IO.IOException:
				//     The stream is closed or an internal error has occurred.
				public: virtual void EndWrite(IAsyncResult* asyncResult)
				{
					throw;
				}

				//
				// Summary:
				//     When overridden in a derived class, clears all buffers for this stream and
				//     causes any buffered data to be written to the underlying device.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     An I/O error occurs.
				public: virtual void Flush() = 0;

				//
				// Summary:
				//     Asynchronously clears all buffers for this stream and causes any buffered
				//     data to be written to the underlying device.
				//
				// Returns:
				//     A task that represents the asynchronous flush operation.
				//
				// Exceptions:
				//   System.ObjectDisposedException:
				//     The stream has been disposed.
				//[ComVisible(false)]
				public: GC_PTR<Task> FlushAsync()
				{
					throw;
				}

				//
				// Summary:
				//     Asynchronously clears all buffers for this stream, causes any buffered data
				//     to be written to the underlying device, and monitors cancellation requests.
				//
				// Parameters:
				//   cancellationToken:
				//     The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
				//
				// Returns:
				//     A task that represents the asynchronous flush operation.
				//
				// Exceptions:
				//   System.ObjectDisposedException:
				//     The stream has been disposed.
				//[ComVisible(false)]
				public: virtual GC_PTR<Task> FlushAsync(CancellationToken* cancellationToken)
				{
					throw;
				}

				//
				// Summary:
				//     Provides support for a System.Diagnostics.Contracts.Contract.
				//[Obsolete("Do not call or override this method.")]
				protected: virtual void ObjectInvariant()
				{
					throw;
				}

				//
				// Summary:
				//     When overridden in a derived class, reads a sequence of bytes from the current
				//     stream and advances the position within the stream by the number of bytes
				//     read.
				//
				// Parameters:
				//   buffer:
				//     An array of bytes. When this method returns, the buffer contains the specified
				//     byte array with the values between offset and (offset + count - 1) replaced
				//     by the bytes read from the current source.
				//
				//   offset:
				//     The zero-based byte offset in buffer at which to begin storing the data read
				//     from the current stream.
				//
				//   count:
				//     The maximum number of bytes to be read from the current stream.
				//
				// Returns:
				//     The total number of bytes read into the buffer. This can be less than the
				//     number of bytes requested if that many bytes are not currently available,
				//     or zero (0) if the end of the stream has been reached.
				//
				// Exceptions:
				//   System.ArgumentException:
				//     The sum of offset and count is larger than the buffer length.
				//
				//   System.ArgumentNullException:
				//     buffer is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     offset or count is negative.
				//
				//   System.IO.IOException:
				//     An I/O error occurs.
				//
				//   System.NotSupportedException:
				//     The stream does not support reading.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				public: virtual int Read(Array<byte>* buffer, int offset, int count) = 0;
						
				public: virtual int Read(byte* buffer, int index, int count) = 0;

				//
				// Summary:
				//     Asynchronously reads a sequence of bytes from the current stream and advances
				//     the position within the stream by the number of bytes read.
				//
				// Parameters:
				//   buffer:
				//     The buffer to write the data into.
				//
				//   offset:
				//     The byte offset in buffer at which to begin writing data from the stream.
				//
				//   count:
				//     The maximum number of bytes to read.
				//
				// Returns:
				//     A task that represents the asynchronous read operation. The value of the
				//     TResult parameter contains the total number of bytes read into the buffer.
				//     The result value can be less than the number of bytes requested if the number
				//     of bytes currently available is less than the requested number, or it can
				//     be 0 (zero) if the end of the stream has been reached.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     buffer is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     offset or count is negative.
				//
				//   System.ArgumentException:
				//     The sum of offset and count is larger than the buffer length.
				//
				//   System.NotSupportedException:
				//     The stream does not support reading.
				//
				//   System.ObjectDisposedException:
				//     The stream has been disposed.
				//
				//   System.InvalidOperationException:
				//     The stream is currently in use by a previous read operation.
				//[ComVisible(false)]
				public: GC_PTR<Collections::Generic::Task<int>> ReadAsync(GC_PTR<byte>* buffer, int offset, int count)
				{
					throw;
				}

				//
				// Summary:
				//     Asynchronously reads a sequence of bytes from the current stream, advances
				//     the position within the stream by the number of bytes read, and monitors
				//     cancellation requests.
				//
				// Parameters:
				//   buffer:
				//     The buffer to write the data into.
				//
				//   offset:
				//     The byte offset in buffer at which to begin writing data from the stream.
				//
				//   count:
				//     The maximum number of bytes to read.
				//
				//   cancellationToken:
				//     The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
				//
				// Returns:
				//     A task that represents the asynchronous read operation. The value of the
				//     TResult parameter contains the total number of bytes read into the buffer.
				//     The result value can be less than the number of bytes requested if the number
				//     of bytes currently available is less than the requested number, or it can
				//     be 0 (zero) if the end of the stream has been reached.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     buffer is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     offset or count is negative.
				//
				//   System.ArgumentException:
				//     The sum of offset and count is larger than the buffer length.
				//
				//   System.NotSupportedException:
				//     The stream does not support reading.
				//
				//   System.ObjectDisposedException:
				//     The stream has been disposed.
				//
				//   System.InvalidOperationException:
				//     The stream is currently in use by a previous read operation.
				//[ComVisible(false)]
				public: virtual GC_PTR<Collections::Generic::Task<int>> ReadAsync(GC_PTR<byte>* buffer, int offset, int count, CancellationToken* cancellationToken)
				{
					throw;
				}

				//
				// Summary:
				//     Reads a byte from the stream and advances the position within the stream
				//     by one byte, or returns -1 if at the end of the stream.
				//
				// Returns:
				//     The unsigned byte cast to an Int32, or -1 if at the end of the stream.
				//
				// Exceptions:
				//   System.NotSupportedException:
				//     The stream does not support reading.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				//[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
				public: virtual int ReadByte()
				{
					throw;
				}

				//
				// Summary:
				//     When overridden in a derived class, sets the position within the current
				//     stream.
				//
				// Parameters:
				//   offset:
				//     A byte offset relative to the origin parameter.
				//
				//   origin:
				//     A value of type System.IO.SeekOrigin indicating the reference point used
				//     to obtain the new position.
				//
				// Returns:
				//     The new position within the current stream.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     An I/O error occurs.
				//
				//   System.NotSupportedException:
				//     The stream does not support seeking, such as if the stream is constructed
				//     from a pipe or console output.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				public: virtual long Seek(long offset, SeekOrigin origin) = 0;

				//
				// Summary:
				//     When overridden in a derived class, sets the length of the current stream.
				//
				// Parameters:
				//   value:
				//     The desired length of the current stream in bytes.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     An I/O error occurs.
				//
				//   System.NotSupportedException:
				//     The stream does not support both writing and seeking, such as if the stream
				//     is constructed from a pipe or console output.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				public: virtual void SetLength(long value) = 0;

				//
				// Summary:
				//     Creates a thread-safe (synchronized) wrapper around the specified System.IO.Stream
				//     object.
				//
				// Parameters:
				//   stream:
				//     The System.IO.Stream object to synchronize.
				//
				// Returns:
				//     A thread-safe System.IO.Stream object.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     stream is null.
				public: static GC_PTR<Stream> Synchronized(Stream* stream);

				//
				// Summary:
				//     When overridden in a derived class, writes a sequence of bytes to the current
				//     stream and advances the current position within this stream by the number
				//     of bytes written.
				//
				// Parameters:
				//   buffer:
				//     An array of bytes. This method copies count bytes from buffer to the current
				//     stream.
				//
				//   offset:
				//     The zero-based byte offset in buffer at which to begin copying bytes to the
				//     current stream.
				//
				//   count:
				//     The number of bytes to be written to the current stream.
				public: virtual void Write(Array<byte>* buffer, int offset, int count) = 0;

				//
				// Summary:
				//     Asynchronously writes a sequence of bytes to the current stream and advances
				//     the current position within this stream by the number of bytes written.
				//
				// Parameters:
				//   buffer:
				//     The buffer to write data from.
				//
				//   offset:
				//     The zero-based byte offset in buffer from which to begin copying bytes to
				//     the stream.
				//
				//   count:
				//     The maximum number of bytes to write.
				//
				// Returns:
				//     A task that represents the asynchronous write operation.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     buffer is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     offset or count is negative.
				//
				//   System.ArgumentException:
				//     The sum of offset and count is larger than the buffer length.
				//
				//   System.NotSupportedException:
				//     The stream does not support writing.
				//
				//   System.ObjectDisposedException:
				//     The stream has been disposed.
				//
				//   System.InvalidOperationException:
				//     The stream is currently in use by a previous write operation.
				//[ComVisible(false)]
				public: GC_PTR<Task> WriteAsync(GC_PTR<byte>* buffer, int offset, int count)
				{
					throw;
				}

				//
				// Summary:
				//     Asynchronously writes a sequence of bytes to the current stream, advances
				//     the current position within this stream by the number of bytes written, and
				//     monitors cancellation requests.
				//
				// Parameters:
				//   buffer:
				//     The buffer to write data from.
				//
				//   offset:
				//     The zero-based byte offset in buffer from which to begin copying bytes to
				//     the stream.
				//
				//   count:
				//     The maximum number of bytes to write.
				//
				//   cancellationToken:
				//     The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
				//
				// Returns:
				//     A task that represents the asynchronous write operation.
				//
				// Exceptions:
				//   System.ArgumentNullException:
				//     buffer is null.
				//
				//   System.ArgumentOutOfRangeException:
				//     offset or count is negative.
				//
				//   System.ArgumentException:
				//     The sum of offset and count is larger than the buffer length.
				//
				//   System.NotSupportedException:
				//     The stream does not support writing.
				//
				//   System.ObjectDisposedException:
				//     The stream has been disposed.
				//
				//   System.InvalidOperationException:
				//     The stream is currently in use by a previous write operation.
				//[ComVisible(false)]
				public: virtual GC_PTR<Task> WriteAsync(Array<byte>* buffer, int offset, int count, CancellationToken* cancellationToken)
				{
					throw;
				}

				//
				// Summary:
				//     Writes a byte to the current position in the stream and advances the position
				//     within the stream by one byte.
				//
				// Parameters:
				//   value:
				//     The byte to write to the stream.
				//
				// Exceptions:
				//   System.IO.IOException:
				//     An I/O error occurs.
				//
				//   System.NotSupportedException:
				//     The stream does not support writing, or the stream is already closed.
				//
				//   System.ObjectDisposedException:
				//     Methods were called after the stream was closed.
				public: virtual void WriteByte(byte value)
				{
					throw;
				}

			};
		}
	}
}
#endif //EXTENSIONS_H